package edu.bit.water.controller;

import edu.bit.water.entity.MetaQSDE;
import edu.bit.water.service.MetaQSDEService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/meta_QSDE")
public class MetaQSDEController {

    @Autowired
    private MetaQSDEService metaQSDEService;

    @ResponseBody
    @RequestMapping(value = "/select", method=RequestMethod.GET)
    public Map<String, Object> queryQSDE() {
        Map<String, Object> result = new HashMap<>();
        List<MetaQSDE> list = metaQSDEService.queryQSDE();
        result.put("rows", list);
        return result;
    }

    @ResponseBody
    @RequestMapping("/insert")
    public Map<String, Object> insertMetaQSDE(MetaQSDE metaQSDE) {
        //metaQSDE.showContent();
        Map<String, Object> result = metaQSDEService.insertMetaQSDEService(metaQSDE);
        return result;
    }

    /**
     * 删除metaQSDE
     * author Page
     */
    @ResponseBody
    @RequestMapping("/delete")
    public Map<String, Object> deleteMetaQSDE(@RequestBody List<String>metaQSDE) {
        return metaQSDEService.deleteMetaQSDE(metaQSDE);
    }

    @ResponseBody
    @RequestMapping("/update")
    public Map<String, Object> updateMetaQSDE(MetaQSDE metaQSDE) {
        Map<String, Object> result = metaQSDEService.updateMetaQSDEService(metaQSDE);
        return result;
    }
}
